/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * <p>Project: jse2303 - InputStream2
 * <p>Powered by webrx On 2023-07-24 11:50:15
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class InputStream2 {
    public static void main(String[] args) {
        try (
                var is = new BufferedInputStream(new FileInputStream("d:/c.jpg"));
                var os = new BufferedOutputStream(new FileOutputStream("d:/c2.jpg"));
        ) {
            long ss = System.currentTimeMillis();
            int b = is.read();

            while (b != -1) {
                os.write(b);
                b = is.read();
            }
            long ee = System.currentTimeMillis();
            System.out.println(ee - ss);
        } catch (Exception e) {

        }
    }
}
